package com.logger.persistance.model;

import java.sql.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.JoinColumn;



@Entity
@Table(name = "log_file")
public class LogTransaction extends BaseObject {

    @Id
    @Column(name = "Transaction_id")
    private Integer transactionId;
    
    @Column(name = "Transaction_start")
    private Date transactionStart;
    
    @Column(name = "Transaction_end")
    private Date transactionEnd;
     
    @ManyToOne
    @JoinColumn(name = "Transaction_state" , referencedColumnName="State_id")
    private Integer  transactionState;
    
    @ManyToOne
    @JoinColumn(name = "LogFile_id" , referencedColumnName="LogFile_id")
    private Integer logFile_Id ;
    
    @OneToMany (mappedBy ="logTransaction_id" , cascade = CascadeType.REMOVE)
    private List<LogQuery> logQuery;
    
    
    public Integer getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(Integer transactionId) {
        this.transactionId = transactionId;
    }

    public Date getTransactionStart() {
        return transactionStart;
    }

    public void setTransactionStart(Date transactionStart) {
        this.transactionStart = transactionStart;
    }

    public Date getTransactionEnd() {
        return transactionEnd;
    }

    public void setTransactionEnd(Date transactionEnd) {
        this.transactionEnd = transactionEnd;
    }

    public Integer getTransactionState() {
        return transactionState;
    }

    public void setTransactionState(Integer transactionState) {
        this.transactionState = transactionState;
    }

    public Integer getLogFileId() {
        return logFile_Id;
    }

    public void setLogFileId(Integer logFileId) {
        this.logFile_Id = logFileId;
    }

    public LogTransaction(Integer transactionId, Date transactionStart, Date transactionEnd, Integer transactionState, Integer logFileId) {
        super();
        this.transactionId = transactionId;
        this.transactionStart = transactionStart;
        this.transactionEnd = transactionEnd;
        this.transactionState = transactionState;
        this.logFile_Id = logFileId;
    }

    @ManyToOne
    @JoinColumn(name = "LogFile_id" , referencedColumnName="LogFile_id")
    private Integer logFileId;
     
    @Override
    public String toString() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public boolean equals(Object o) {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public int hashCode() {
        // TODO Auto-generated method stub
        return 0;
    }

}
